import { createApp } from 'vue'
import App from './App.vue'
import { setupRouter } from './router'
import { setupStore } from './store'
import { useREM } from './utils/flexible'
import { setupLibs } from './libs'
import { setupDirectives } from './directives'
import useTheme from './utils/theme'
import './styles/index.scss'
// 引入 svg 图标
import 'virtual:svg-icons-register'
import './permission'

async function bootstrap() {
  // 动态指定rem基准值
  useREM()
  const app = createApp(App)
  // 状态管理
  setupStore(app)
  // 路由
  setupRouter(app)
  // 组件引入
  setupLibs(app)
  // 自定义指令
  setupDirectives(app)
  // Theme
  useTheme()
  // 挂载
  app.mount('#app')
}

bootstrap()
